Escape (abort) from guiTextField edit session

  • So near, yet so far...


    I’ve been cobbling together a plugin which centers around a fairly involved gui interface. In my final testing I’m focusing on error detection/recovery and foolproofing the gui to prevent the user from winding up in an awkward situation which may or may not be easy to recover from.


    The only known bug left (forget the unknown ones for now :whistling: ) is the supporting of the Escape key as the universal abort tool. As it stands now, hitting Escape at any point in the usage of this gui terminates the current action and gracefully backs out of the task at hand. The one situation I can’t seem to do that for is when using a guiTextField.


    When such a field is in focus, I don’t seem to get any onPlayerKeyEvents, so I have no way to inject my own abort sequence. When Escape is typed during a guiTextField edit session, the result is the appearance of the RW options window (Settings/Friends/Permissions/Return to main menu/Quit), right in front of the textField element. Getting out of that situation is a little tricky and not obvious, and may leave you in a worse situation.


    I can (and have) incorporated alternate ways to abort the textField, but I really want to either have Escape do the natural thing or prevent it from doing anything at all. It's pretty certain the user will hit that key eventually.


    So far I’ve tried a number of combinations and variations of:

    • GuiTextField.setListenForInput()
    • Player.registerKeys()
    • Player.setListenForKeyInput()
    • Player.enableClientsideKeys()
    • Player.disableClientsideKey()

    All interesting stuff, but I can’t seem to reach my goal. Anybody done this?


    I’m looking for actual solutions or suggestions. Not so much guesses that haven’t been tested. ;)

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!